//package com.lam.task;
//
//import java.io.IOException;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//import org.apache.commons.collections4.MapUtils;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import org.springframework.transaction.annotation.Transactional;
//
//import com.lam.common.utils.CollectionUtil;
//import com.lam.common.utils.http.HttpClientUtils;
//import com.lam.schedule.common.scheduler.annotation.TaskTarget;
//import com.lam.task.mapper.DxCustMapper;
//
//@TaskTarget
//@Component
//public class DxCustLinkTask {
//	
//	 private final Logger logger = LoggerFactory.getLogger(getClass());
//	 
//	 @Autowired
//	 private DxCustMapper dxCustMapper;
//	 @Autowired
//	 private DxCustLinkTask dxCustLinkTask;
//	
//	@TaskTarget
//    public void sync(Map<String, Object> pm){
//		
//		String url = "http://ncs.bqjr.cn/cases/csPhones/page";
//		
//		int totalPage = 2444;
//		Map<String, Object> param = new HashMap<>();
//		param.put("pageSize", 5000);
//		Map<String, String> header = new HashMap<>();
//		header.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9");
//		header.put("Accept-Encoding", "gzip, deflate");
//		header.put("Accept-Language", "zh-CN,zh;q=0.9");
//		header.put("Connection", "keep-alive");
//		header.put("Cookie", "appCode=1001; 27d2e83f8951d6f83b7570d101265020=YjM0YTc5ODU2MzcyZjg0NTZkZWZjNWMxNGNmNGM4N2YuOGIyZjViOWZjODFkNDM0ODJlYmY4ZjljY2I0NjM0MjYuTnpRME9UZzFOelV4TXpRMU9UazFNUT09NA==; 77369866c44fd74229972ae493beb720=MGIzNGE3OTg1NjM3MmY4NDU2ZGVmYzVjMTRjZjRjODdmLjROelEwT1RnMU56VXhNelExT1RrMU1RPT0uN1ZqRmtkMWR0Vm5OaVJsWlhZbGhvVVZWcVJrWmxWbEpWVTJzNWFHRjZWa2xXYlRGdldWWkpkMkpFVGxWaWJrSnlXVlpWTVU1c1JuUmxSa0pUVFZaWmVsWkVSbE5SYXpWV1RsUmFXRlpFUVRrPQ==; 92d4236b0c585077cd7cb14ef82e0977=YjM0YTc5ODU2MzcyZjg0NTZkZWZjNWMxNGNmNGM4N2YuYTk5ZDAwOWJlNWRkMDZiOGI2MDc2ZWM3ZjJmOTNiNjYuTnpRM05qSTVNRFExTmpjM09ETTJOQT09Mg==; 4c37a5970f79b60f15e921dc91f01966=NGIzNGE3OTg1NjM3MmY4NDU2ZGVmYzVjMTRjZjRjODdmLjhOelEzTmpJNU1EUTFOamMzT0RNMk5BPT0uOFRrZEdhRnBVVlRSTmJVMTZUMWRHYlU1RVZUSk5SR2hvVFRKS2FrNVVSVE5OZWtGM1QxZEthazU2VFQwPQ==");
//		header.put("Host", "ncs.bqjr.cn");
//		header.put("Upgrade-Insecure-Requests", "1");
//		header.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36");
//
//		int pageIndex = MapUtils.getIntValue(pm, "pageIndex", 0);
//		while(pageIndex < totalPage) {
//			Map<String, Object> result = null;
//			try {
//				param.put("pageIndex", pageIndex);
//				logger.info("获取数据页码: {}", pageIndex);
//				result = HttpClientUtils.get(url, param, header);
//				pageIndex ++ ;
//			} catch (IOException e) {
//				logger.error("获取数据异常, pageIndex:"+pageIndex, e);
//				continue;
//			}
//			
//			if(CollectionUtil.isNotEmpty(result)) {
//				Object dataList = result.get("data");
//				List<Map<String, Object>> list = (List<Map<String, Object>>)dataList;
//				dxCustLinkTask.batchInsert(list);
//			}
//		}
//	}
//	
//	@Transactional
//	public void batchInsert(List<Map<String, Object>> list) {
//		dxCustMapper.batchInsertLink(list);
//	}
//
//}
